let name = 'ahhh';
let age = 10;
/*let str = `<ul>
    <li>${name} ${age}</li>
</ul>`;
console.log(str);*/

let str = "<ul> <li>${name} ${age}</li> </ul>";
//                  ↓切记用? 防止贪婪 +:至少一个
let result = str.replace(/\$\{(.+?)\}/g, function () {
  console.log(arguments[1]);
  return eval(arguments[1])
});
console.log(result);

